package com.xyzwps.paimon.furina.modules.post

import com.xyzwps.paimon.furina.modules.post.entity.Post
import com.xyzwps.paimon.furina.modules.post.entity.PostCollection
import com.xyzwps.paimon.furina.modules.post.entity.PostType
import com.xyzwps.paimon.furina.modules.userinfo.entity.UserInfoSummary
import kotlinx.datetime.LocalDateTime

data class PostCollectionDTO(val id: Long, val title: String, val updatable: Boolean) {
    constructor(c: PostCollection, updatable: Boolean) : this(
        id = c.id,
        title = c.title,
        updatable = updatable,
    )
}

data class PostDTO(
    val id: Long,
    val author: UserInfoSummary?,
    val collection: PostCollectionDTO?,
    val title: String,
    val type: PostType,
    val content: String,
    val createTime: LocalDateTime,
    val updatable: Boolean
) {
    constructor(
        p: Post,
        author: UserInfoSummary?,
        collection: PostCollectionDTO?,
        updatable: Boolean
    ) : this(
        id = p.id,
        author = author,
        collection = collection,
        title = p.title,
        type = p.type,
        content = p.content,
        createTime = p.createTime,
        updatable = updatable
    )
}